<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>文章管理</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcss.com/vue-resource/1.5.0/vue-resource.js"></script>
</head>
<body>
    <h1>文章列表</h1>
    <hr>
    <table id="articlelist" border="1px">
        <tr>
            <th>文章编号</th>
            <th>文章标题</th>
            <th>分类</th>
            <th>点赞数</th>
            <th>反对数</th>
            <th>标记</th>
            <th>创建时间</th>
            <th>是否有效</th>
            <th>预览</th>
            <th>修改</th>
        </tr>
        <tr v-for="item in items">
            <td v-for="value in item">{{value}}</td>
            <td><a :href="'/article/show?id='+item[0]">查看</a></td>
            <td><a :href="'/article/modify?id='+item[0]">修改</a></td>
        </tr>
        <a href="/article/edit">添加文章</a>
    </table>
</body>
<script>
    var vm = new Vue({
        el : '#articlelist',
        data : {items:[]},
        created : function(){
            this.$http.get("http://localhost/api/article/list").then(function(data){
                this.items = data.body;
            });
        }
    });
</script>
</html>